package rctgl.util;

import java.io.InputStream;
import java.io.IOException;

public class StreamUtils
{
	public static int readInt8(InputStream stream) throws IOException
	{
		return stream.read();
	}
	
	public static int readInt16(InputStream stream) throws IOException
	{
		int msb = stream.read();
		int lsb = stream.read();
		
		return (msb << 8) + lsb;
	}
	
	public static int readInt32(InputStream stream) throws IOException
	{
		int msb1 = stream.read();
		int msb2 = stream.read();
		int msb3 = stream.read();
		int msb4 = stream.read();
		
		return msb4 +
			(msb3 << 8) +
			(msb2 << 16) +
			(msb1 << 24);
	}

}
